#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
//https://ac.nowcoder.com/acm/problem/50614

using namespace std;
int n, k;
int main()
{
	cin >> n >> k;
	if (n % (k + 1))
	{
		cout << 1 << endl;
	}
	else cout << 2 << endl;

	return 0;
}